﻿using System.Text;

namespace MyStory.util
{
    public class ConnectUrl
    {
        /// <summary>
        /// 小说搜索连接
        /// </summary>
        /// <param name="option">必填！ 选择搜索项，1，title,2.author,3.fictionType  </param>
        /// <param name="key">必填！小说名称，关键字</param>
        /// <param name="from">可选！当前页数</param>
        /// <param name="size">可选！一页显示数量</param>
        /// <returns></returns>
        public static string GetSearchUrl(string option ,string key,int from=1,int size=10)
        {
            string baseUrl = "https://api.pingcc.cn/fiction/search";
            StringBuilder MyStringBuilder = new StringBuilder();
            MyStringBuilder.Append(baseUrl);
            MyStringBuilder.Append("/");
            MyStringBuilder.Append(option);
            MyStringBuilder.Append("/");
            MyStringBuilder.Append(key);
            MyStringBuilder.Append("/");
            MyStringBuilder.Append(from);
            MyStringBuilder.Append("/");
            MyStringBuilder.Append(size);
            string SearchUrl = MyStringBuilder.ToString();           
            return SearchUrl;
        }

        /// <summary>
        /// 小说的章节连接
        /// </summary>
        /// <param name="fictionId">必填！搜索获取的fictionId</param>
        /// <returns></returns>
        public static string GetChapterUrl(string fictionId)
        {
            string baseUrl = "https://api.pingcc.cn/fictionChapter/search";
            StringBuilder MyStringBuilder = new StringBuilder();
            MyStringBuilder.Append(baseUrl);
            MyStringBuilder.Append("/");
            MyStringBuilder.Append(fictionId);         
            string ChapterUrl = MyStringBuilder.ToString();
            return ChapterUrl;
        }

        /// <summary>
        /// 小说的内容连接
        /// </summary>
        /// <param name="fictionId">必填！通过章节获取的chapterId</param>
        /// <returns></returns>
        public static string GetContentUrl(string chapterId)
        {
            string baseUrl = "https://api.pingcc.cn/fictionContent/search";
       
            StringBuilder MyStringBuilder = new StringBuilder();
            MyStringBuilder.Append(baseUrl);
            MyStringBuilder.Append("/");
            MyStringBuilder.Append(chapterId);
            string ContentUrl = MyStringBuilder.ToString();
            return ContentUrl;
        }


    }
}